Skip to content

get the site out #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 31, 2025
Merged

get the site out #23

merged 3 commits into from
May 31, 2025

Conversation

lqez
Copy link
Collaborator

@lqez lqez commented May 31, 2025

Summary by CodeRabbit

  • Chores

    • Updated configuration files to improve dependency management and deployment reliability, including installation steps for Node.js and Node.js packages.
    • Added a new package configuration with a development dependency for cross-platform environment variable support.
    • Updated fixture data to use site configuration referencing a root page, replacing previous page-specific data.
  • Bug Fixes

    • Corrected Tailwind CSS plugin configuration to prevent duplication and ensure valid setup.

Copy link
Contributor

coderabbitai bot commented May 31, 2025

Walkthrough

Node.js support was added across the project by updating the Dockerfile, deployment, and entrypoint scripts to install Node.js and run npm install. A .gitignore entry for node_modules was introduced. A package.json with a development dependency was added. Tailwind CSS plugin configuration and fixture data were updated.

Changes

File(s) Change Summary
.gitignore Added ignore rule for node_modules under a new "Node packages" section.
Dockerfile Added installation steps for Node.js v22; reformatted ENTRYPOINT for newline at end.
deploy_prod.sh, entrypoint.sh Inserted npm install before backend setup to ensure Node.js dependencies are installed during deployment and entrypoint execution.
package.json Added new file with cross-env as a development dependency.
pythonkr_backend/fixtures.json Replaced a root page fixture with a site configuration fixture referencing a root page by ID.
pythonkr_backend/theme/static_src/tailwind.config.js Fixed Tailwind CSS plugin config by removing duplicate and nested plugins arrays; consolidated all plugins into a single array.

Sequence Diagram(s)

sequenceDiagram
    participant Docker as Dockerfile
    participant Entrypoint as entrypoint.sh
    participant Deploy as deploy_prod.sh
    participant NPM as npm
    participant Backend as Python Backend

    Docker->Entrypoint: Build image (Node.js installed)
    Entrypoint->NPM: Run npm install
    Entrypoint->Backend: Activate virtualenv and start server

    Deploy->NPM: Run npm install
    Deploy->Backend: Activate virtualenv, run backend update commands
Loading

Poem

A hop, a skip, Node.js arrives,
With npm install, our code now thrives.
Tailwind plugins neat and tight,
Fixtures set the site just right.
Ignore those modules, keep things clean,
A rabbit’s joy, in code unseen! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@darjeeling darjeeling merged commit 7051bc6 into pythonkr:main May 31, 2025
1 of 2 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (2)
entrypoint.sh (1)

1-6: 🛠️ Refactor suggestion

Add strict error handling and consider caching Node modules

  • Insert set -euo pipefail at the top to fail fast on any error.
  • Installing dependencies on each startup adds latency; consider moving npm install into the Docker build to leverage layer caching.
 #!/usr/bin/env bash
+set -euo pipefail
 cd /app
 npm install
 source .venv/bin/activate
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

Dockerfile (1)

27-28: 🛠️ Refactor suggestion

Ensure entrypoint script is executable
Add a step to set execute permissions on entrypoint.sh to prevent errors when Docker invokes it.

 COPY . /app
+RUN chmod +x /app/entrypoint.sh
 ENTRYPOINT [ "/app/entrypoint.sh" ]
🧹 Nitpick comments (2)
.gitignore (1)

175-178: Use explicit directory pattern for node_modules
The entry node_modules will ignore any file or directory named “node_modules”. For clarity and to target the directory specifically, use node_modules/.

 # Node packages
-node_modules
+node_modules/
Dockerfile (1)

8-15: Optimize and secure Node.js installation

  • Use --no-install-recommends to reduce image size.
  • Consider verifying the NodeSource GPG key or using the official Node.js image in a multi-stage build to shrink the final artifact.
 RUN apt-get update \
-    && apt-get install -y curl gnupg \
+    && apt-get install -y --no-install-recommends curl gnupg \
     && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
-    && apt-get install -y nodejs \
+    && apt-get install -y --no-install-recommends nodejs \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/*
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e673d70 and e20de01.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • .gitignore (1 hunks)
  • Dockerfile (2 hunks)
  • deploy_prod.sh (1 hunks)
  • entrypoint.sh (1 hunks)
  • package.json (1 hunks)
  • pythonkr_backend/fixtures.json (1 hunks)
  • pythonkr_backend/theme/static_src/tailwind.config.js (1 hunks)
🔇 Additional comments (3)
deploy_prod.sh (1)

25-28:

❓ Verification inconclusive

Enforce robust execution and verify Node.js availability

  • Add set -euo pipefail to exit on errors.
  • Check that node is installed before running npm install to prevent silent failures.
  • Ensure package.json resides in python.or.kr for npm install to work.
 #!/usr/bin/env bash
+set -euo pipefail
 PID_FILE="/home/pk/pk.pid"
 # ...
 cd python.or.kr
+command -v node >/dev/null 2>&1 || { echo "Node.js not found"; exit 1; }
 npm install
 source .venv/bin/activate

Please confirm the production host environment has Node.js installed or adjust this script to install the required runtime.


Let's inspect the deployment script and its context to confirm the suggestions:


🏁 Script executed:

#!/usr/bin/env bash
set -e
# Locate deploy_prod.sh
SCRIPT_PATH=$(fd --hidden deploy_prod.sh | head -n1)
echo "Using: $SCRIPT_PATH"
# Show the first 30 lines and lines 20–40 to view shebang, env settings, and cd usage
sed -n '1,30p' "$SCRIPT_PATH"
echo "----"
sed -n '20,40p' "$SCRIPT_PATH"

Length of output: 1236


🏁 Script executed:

#!/usr/bin/env bash
# Verify that package.json exists in python.or.kr
if [ -d python.or.kr ]; then
  find python.or.kr -maxdepth 1 -type f -name 'package.json' -print || echo "No package.json found in python.or.kr"
else
  echo "Directory python.or.kr not found"
fi

# Check Node.js availability in this environment
if command -v node >/dev/null 2>&1; then
  echo "Node.js is installed: $(node -v)"
else
  echo "Node.js not found"
fi

Length of output: 198


Enforce robust execution and verify Node.js availability

  • Add set -euo pipefail at the top to fail fast on errors.
  • Confirm node is installed (we detected Node.js v24.1.0).
  • Ensure the python.or.kr directory exists on the production host and contains a valid package.json before running npm install.

Suggested diff in deploy_prod.sh:

 #!/usr/bin/env bash
+set -euo pipefail

 cd ~/
 source .env
 cd python.or.kr
+command -v node >/dev/null 2>&1 || { echo "Node.js not found"; exit 1; }
 npm install
 source .venv/bin/activate
 uv sync
 cd pythonkr_backend
 …  

Please verify on your production server that python.or.kr is the correct path and that package.json is present.

pythonkr_backend/theme/static_src/tailwind.config.js (1)

54-55: Consolidated plugins array is correct
You’ve removed the nested duplication and now declare all three plugins—forms, typography, and aspect-ratio—exactly once in the top-level plugins array. This ensures Tailwind will load them as expected without configuration conflicts.

pythonkr_backend/fixtures.json (1)

20-27: Add Wagtail site fixture
The new "wagtailcore.site" entry correctly defines your primary site—setting hostname, port, an empty site_name, root_page: 3 (which matches the later page with pk=3), and is_default_site: true. This aligns with Wagtail’s site configuration requirements. Ensure no other site fixture is marked as default and that your Django settings reference this hostname and port appropriately.

Comment on lines +1 to +5
{
"devDependencies": {
"cross-env": "^7.0.3"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Populate standard metadata and scripts
A minimal package.json should include name, version, and optionally scripts, license, and other fields to support npm workflows and clarify the package’s intent.

Example diff:

 {
+  "name": "pythonkr-frontend",
+  "version": "0.1.0",
   "devDependencies": {
     "cross-env": "^7.0.3"
   },
+  "scripts": {
+    "build:css": "cross-env NODE_ENV=production tailwindcss build"
+  },
+  "license": "MIT"
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"devDependencies": {
"cross-env": "^7.0.3"
}
}
{
"name": "pythonkr-frontend",
"version": "0.1.0",
"devDependencies": {
"cross-env": "^7.0.3"
},
"scripts": {
"build:css": "cross-env NODE_ENV=production tailwindcss build"
},
"license": "MIT"
}
🤖 Prompt for AI Agents
In package.json lines 1 to 5, the file lacks standard metadata fields such as
"name" and "version" which are essential for npm package identification and
management. Add at least the "name" and "version" fields at the top level of the
JSON object. Optionally, include a "scripts" section for common commands and a
"license" field to clarify usage rights. Ensure the JSON structure remains valid
and properly formatted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants